<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'communication-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<?php echo $form->hiddenField($model,'customerId'); ?>
<?php
$typeTags=CHtml::listData(Communication::model()->findAll(array(
						'select'=>'type',
						'distinct'=>true,
					)), 'type', 'type');
$typeFieldId=CHtml::activeId($model,'type');
$typeTagJs=<<<EOF
$('.type-tag').click(function(){
	$('#$typeFieldId').val($(this).html());
	return false;
});
EOF;

Yii::app()->clientScript->registerScript('typeIdTag',$typeTagJs);
?>
	<div class="row">
		<?php echo $form->labelEx($model,'type'); ?>
		<?php echo $form->textField($model,'type',array('size'=>20,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'type'); ?>
		<?php foreach ($typeTags as $typeTag){
			?> <a href="#" class="type-tag"><?php echo $typeTag;?></a>
			<?php
		} ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'contactTime'); ?>
		<?php 
			$this->widget('ext.timepicker.EJuiDateTimePicker',array(
			    'model'=>$model,
			    'attribute'=>'contactTime',
			    ));  
		?>
		<?php echo $form->error($model,'contactTime'); ?>
	</div>

	<?php if (!$model->isNewRecord){?>
	<div class="row">
		<?php echo $form->labelEx($model,'createTime'); ?>
		<?php echo $model->createTime; ?>
	</div>
	<?php }?>
	
	<?php echo $form->hiddenField($model,'createUserId'); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'note'); ?>
		<?php echo $form->textArea($model,'note',array('rows'=>12, 'cols'=>80)); ?>
		<?php echo $form->error($model,'note'); ?>
	</div>

	<?php if (!$model->isNewRecord){?>
	<div class="row">
		<?php echo $form->labelEx($model,'createUserId'); ?>
		<?php echo $model->createUser->getFullName(); ?>
	</div>
	<?php }?>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->